<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	UserBean user = (UserBean)request.getSession().getAttribute("userBean");
	String _db = user.getDbType();
	String org = user.getCurOrgName();
	String orgId = user.getCurOrgId();
	String userName = user.getUserrelName();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="pragma" content="no-cache"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>药具盘点管理</title>
		
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />

		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/validata.js"></script>

		<script type="text/javascript" src="ligerUI/js/plugins/ligerGrid.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerForm.js"></script>
	    <script src="ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
	    <script src="ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>	
<script type="text/javascript">
var _db = '<%=_db%>';
var org = '<%=org%>';
var org_id = '<%=orgId%>';
var userName = '<%=userName%>';

_jsonObj.classname = "com.wxtf.platform.main.contraceptives.TmaStoreCheckMainAction";
_jsonObj.methodname = "queryPage";

var manager;//盘点表格
var TmaStoreCheck;//盘点药品表格
var TmaStoreCheckMainleixing;//药品出库入库
var mingxi = [];
var pandianbianhao = "00000";
var win = true;
$(function(){
	manager = $("#TmaStoreCheckMain-grid").ligerGrid({
		url: _url, parms: _jsonObj, width: '100%', height: '100%',enabledSort:false,
		usePager: true, rownumbers: true, alternatingRow: true,async:false,pageSize:100,
		columns: [
			{ display: 'tmascm_id', name: 'tmascm_id', hide: true, width: 1 },
			{ display: 'tmascm_is_valid', name: 'tmascm_is_valid', width:  1, hide: true },
			{ display: 'caption', name: 'caption', hide: true,width:1 },
			{ display: 'create_by', name: 'create_by', hide: true,width:1 },
			{ display: '盘点编号', name: 'tmascm_code', width: 200, align: 'left', render: function(record, index, value, oth){
					return "<a href='javascript:detail(" + JSON.stringify(record) + ")'>"+value+"</a>";
				} 
			},
			{ display: '盘点种类', name: 'tmascm_type', width: 150, align: 'left' },
			{ display: '盘点名称', name: 'tmascm_name', width:  150, align: 'left' },
			{ display: '盘点时间', name: 'tmascm_time', width:  150, align: 'left' },
			{ display: '查看详情', name:'edit',width:80,render: function(record, index, value, oth){
					return "<img src='ligerUI/skins/icons/search.gif' onclick='detail(" + JSON.stringify(record) + ")'></img>";
				}
			}
		],
		toolbar: {
			items: [
				{ text: '新建', click:function(){
					if(win){
					var param = {
						"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckMainAction",
						"methodname": "yuefen",
						"logicdata": [],
						"extenddata": []
					};
					callserver(param, function(data, satus){
						if(data.resultrecord=="0"){
							addData();
						}else{
							warningTip(data.resultrecord);
						}
					},function(data, satus){
						warningTip(data.resultrecord);
					});
					}					
				}, icon: 'add' }
			]
		}	
	});	
	//盘点药品
	TmaStoreCheck = $("#TmaStoreCheckDetail-grid").ligerGrid({
		url: _url, width: '890', height:'325',enabledSort:false,async:false,delayLoad:true,
		usePager: false, rownumbers: true, alternatingRow: true, enabledEdit: true, onAfterEdit: f_onAfterEdit,
		columns: [
			{ display: 'tmad_id', name: 'tmad_id', hide: true,width:1 ,type: 'string'},
			{ display: 'tmascd_id', name: 'tmascd_id', hide: true,width:1 ,type: 'string'},
			{ display: '药具种类', name: 'tmgd_name', width: 120, align: 'left' ,type: 'string'},
			{ display: '药品名称', name: 'tmad_name', width: 100, align: 'left',type: 'string',render: function(record, index, value, oth){
					return "<a href='javascript:yaopinming(" + JSON.stringify(record) + ")'>"+value+"</a>";
				}
			},			
			{ display: '生产厂家', name: 'tmad_company_name', width: 100, align: 'left' ,type: 'string'},
			{ display: '批号', name: 'tmad_batch_code', width: 50, align: 'left' ,type: 'string'},
			{ display: '保质期', name: 'tmad_qgp', width: 1, hide:true, align: 'left' ,type: 'string'},
			{ display: '状态', name: 'tmad_status', width: 50, align: 'left' ,type: 'string',render: function(record, index, value, oth){
					if(value=="0"){
						return "启用";
					}else if(value=="1"){
						return "停用";
					}
				}
			},
			{ display: '价格', name: 'tmad_price', width: 50, align: 'left' ,type: 'float'},
			{ display: '上期库存', name: 'back_tmascd_num', width: 70, align: 'left', type: 'int'},
			{ display: '本期入库', name: 'tmaid_num', width: 70, align: 'left', type: 'int'},
			{ display: '本期出库', name: 'tmaod_num', width: 70, align: 'left', type: 'int'},
			{ display: '本期结余', name: 'tmascd_num', width: 70, align: 'left', type: 'int'},
			{ display: '盘盈亏', name: 'tmascd_num_yk', width: 50, align: 'left', type: 'int', editor: { type: 'int'}},
			{ display: '报损', name: 'tmascd_num_s', width: 50, align: 'left', type: 'int'},
			{ display: '宣传', name: 'tmascd_num_c', width: 50, align: 'left', type: 'int', editor: { type: 'int'}},
			{ display: '实际数量', name: 'num', width: 70, align: 'left', type: 'int'},
			{ display: '金额', name: 'money', width: 100, align: 'left', type: 'float',render: function(record, index, value, oth){
					return formatCurrency(record.money);
				}
			}
		],
		toolbar: {
			items: [
				{ text: '计算', click:jisuan, icon: 'add' },
				{ line: true },
				{ text: '<div id="quanbu" onclick="quanbu();">全部</div><div style:"display:none;" id="fafang" onclick="fafang();">差异</div>' }
			]
		}	
	});
	
	//药品出库入库
	TmaStoreCheckMainleixing = $("#TmaStoreCheckMainleixing-grid").ligerGrid({
		url: _url, width: '540', height:'325',enabledSort:false,async:false,delayLoad:true,pageSize:100,
		usePager: true, rownumbers: true, alternatingRow: true, enabledEdit: true, groupColumnName:'t_type',
		columns: [
			{ display: 't_type', name: 't_type', hide: true, width: 1 },
			{ display: '药品名称', name: 'tmad_name', width: 100, align: 'left' },			
			{ display: '生产厂家', name: 'tmad_company_name', width: 100, align: 'left' },
			{ display: '数量', name: 'num', width: 60, align: 'left'},
			{ display: '办理人', name: 'create_by', width: 70, align: 'left' },
			{ display: '办理时间', name: 'create_time', width: 100, align: 'left' },
			{ display: '类型', name: 'leixing', width: 50, align: 'left'}
		]	
	});
});
function fafang(){
	$("#fafang").hide();
	$("#quanbu").show();
	//定义参数
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckDetailAction",
		"methodname": "queryPage",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmascm_id\":\"\",\"dis\":\"0\"}]";
	TmaStoreCheck.setOptions({url:_url,parms: param});
}
function quanbu(){
	$("#fafang").show();
	$("#quanbu").hide();
	//定义参数
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckDetailAction",
		"methodname": "queryPage",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmascm_id\":\"\",\"dis\":\"\"}]";
	TmaStoreCheck.setOptions({url:_url,parms: param});
}
function f_onAfterEdit(e)
{
	var no = parseInt(e.record.tmascd_num) + parseInt(e.record.tmascd_num_yk)  - parseInt(e.record.tmascd_num_s) - parseInt(e.record.tmascd_num_c);
	TmaStoreCheck.updateCell('num', no, e.record);
	TmaStoreCheck.updateCell('money', no * parseFloat(e.record.tmad_price), e.record);
}        
/*
 * 表格刷新
 */
function reload(){
	_jsonObj.methodname = "queryPage";
	_jsonObj.logicdata = "[]";
	manager.loadData();
}
var detail_dialog;
function detail(record){
	$("#d_tmascm_code").val(record.tmascm_code);
	$("#d_tmascm_name").val(record.tmascm_name);
	$("#d_org_id").val(record.caption);
	$("#d_create_by").val(record.create_by);
	$("#d_money").val(0);
	detail_dialog = initWindowByDiv2('TmaStoreCheckDetail-div', '药具盘点查看', 880, 480, function(){
		if(TmaStoreCheckMainleixing_d==null){
		}else{
			TmaStoreCheckMainleixing_d.hide();
		}
		detail_dialog.hide();
	});
	//定义明细的参数
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckDetailAction",
		"methodname": "detail",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmascm_id\":\""+record.tmascm_id+"\"}]";
	//查看详情
	var d = $("#detail1").ligerGrid({
		url:_url, parms: param, width: '855', height:'325',enabledSort:false,async:false,
		usePager: false, rownumbers: true, alternatingRow: true,
		columns: [
			{ display: '药具种类', name: 'tmgd_name', width: 120, align: 'left' ,type: 'string'},
			{ display: '药品名称', name: 'tmad_name', width: 100, align: 'left',type: 'string',render: function(record, index, value, oth){
					return "<a href='javascript:yaopinming(" + JSON.stringify(record) + ")'>"+value+"</a>";
				}
			},			
			{ display: '生产厂家', name: 'tmad_company_name', width: 100, align: 'left' ,type: 'string'},
			{ display: '批号', name: 'tmad_batch_code', width: 50, align: 'left' ,type: 'string'},
			{ display: '保质期', name: 'tmad_qgp', width: 1, hide:true, align: 'left' ,type: 'string'},
			{ display: '状态', name: 'tmad_status', width: 50, align: 'left' ,type: 'string',render: function(record, index, value, oth){
					if(value=="0"){
						return "启用";
					}else if(value=="1"){
						return "停用";
					}
				}
			},
			{ display: '价格', name: 'tmad_price', width: 50, align: 'left' ,type: 'float'},
			{ display: '上期库存', name: 'back_tmascd_num', width: 70, align: 'left', type: 'int'},
			{ display: '本期入库', name: 'tmaid_num', width: 70, align: 'left', type: 'int'},
			{ display: '本期出库', name: 'tmaod_num', width: 70, align: 'left', type: 'int'},
			{ display: '本期结余', name: 'tmascd_num', width: 70, align: 'left', type: 'int'},
			{ display: '盘盈亏', name: 'tmascd_num_yk', width: 50, align: 'left', type: 'int', editor: { type: 'int'}},
			{ display: '报损', name: 'tmascd_num_s', width: 50, align: 'left', type: 'int'},
			{ display: '宣传', name: 'tmascd_num_c', width: 50, align: 'left', type: 'int', editor: { type: 'int'}},
			{ display: '实际数量', name: 'num', width: 70, align: 'left', type: 'int'},
			{ display: '金额', name: 'money', width: 100, align: 'left', type: 'float'}
		],
		toolbar: {
			items: [
				{ text: '再次盘点', click:function(){
					var param = {
						"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckMainAction",
						"methodname": "zaicipandian",
						"logicdata": [],
						"extenddata": []
					};
					param.logicdata = "[{\"tmascm_id\":\""+record.tmascm_id+"\"}]";
					callserver(param, function(data, satus){
						if(data.resultrecord=="0"){
							win = false;
							updateData(record);
						}else{
							warningTip(data.resultrecord);
						}
					},function(data, satus){
						warningTip(data.resultrecord);
					});					
				}, icon: 'add' },
				{ line: true },
				{ text: '导出', click: function(){
					expData(record);
				}, icon: 'xls' },
				{ line: true },
				{ text: '计算', click: function(){
					var no = 0.00;
					$.each(d.getData(), function (i, item) {
       					no = parseFloat(no) + parseFloat(item.money);
    				});
    				$("#d_money").val(formatCurrency(no));
				}, icon: 'add' }
			]
		}
	});
}
/*
 * 再次盘点
 */
function updateData(row){	
	mingxi = [];
	document.getElementById('TmaStoreCheckMain-form').reset();
	loadForm("TmaStoreCheckMain-form", row);
	$("#org_id").val(row.caption);
	detail_dialog.hide();
	$("#a1").html("0");
	$("#fafang").hide();
	$("#quanbu").show();
	$("#TmaStoreCheckMainAdd-div").show();
	//addData_dialog = initWindowByDiv('TmaStoreCheckMainAdd-div', '再次盘点', 900, 450, insert, closeWin);
	//定义明细的参数
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckDetailAction",
		"methodname": "queryPage",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmascm_id\":\""+row.tmascm_id+"\",\"dis\":\"0\"}]";
	TmaStoreCheck.setOptions({url:_url,parms: param});
}

/*
 * 药具盘点
 */
function addData(){
	win = false;
	mingxi = [];
	document.getElementById('TmaStoreCheckMain-form').reset();
	var shijian = getCurDateTime();
	var nian = shijian.substring(0,shijian.indexOf("-"));
	var yue = shijian.substring(shijian.indexOf("-")+1,shijian.lastIndexOf("-"));
	var tian = shijian.substring(shijian.lastIndexOf("-")+1,shijian.indexOf(" "));
	var xiaoshi = shijian.substring(shijian.lastIndexOf(" ")+1,shijian.indexOf(":"));
	var fenzhong = shijian.substring(shijian.indexOf(":")+1,shijian.lastIndexOf(":"));
	var miao = shijian.substring(shijian.lastIndexOf(":")+1);
	var str = "KM" + nian + yue + tian + xiaoshi + fenzhong + miao;
	var pandianbianhaoSize = pandianbianhao.length;
	var	intSeq = parseInt(pandianbianhao);
	intSeq++;
	var seqSize = (intSeq + "").length;
	var s = "";
	while (pandianbianhaoSize - seqSize > 0)
	{
		s += "0";
		pandianbianhaoSize--;
	}
	pandianbianhao = s + intSeq;
	str = str + s + intSeq;
	$("#tmascm_code").val(str);
	$("#a1").html("0");
	$("#org_id").val(org);
	$("#tmascm_id").val("");
	$("#create_by").val(userName);
	$("#fafang").hide();
	$("#quanbu").show();
	$("#TmaStoreCheckMainAdd-div").show();
	//addData_dialog = initWindowByDiv('TmaStoreCheckMainAdd-div', '药具盘点', 900, 450, insert, closeWin);
	//定义参数
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckDetailAction",
		"methodname": "queryPage",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmascm_id\":\"\",\"dis\":\"0\"}]";
	TmaStoreCheck.setOptions({url:_url,parms: param});	
}
//合计
function jisuan(){
	var no = 0.00;            
	var jsonObj = {};
    jsonObj.Rows = [];
	$.each(TmaStoreCheck.getData(), function (i, item) {
		jsonObj.Rows.push({
        	tmad_id:item.tmad_id,
        	tmascd_id:item.tmascd_id,
			tmgd_name:item.tmgd_name,
			tmad_name:item.tmad_name,			
			tmad_company_name:item.tmad_company_name,
			tmad_price:item.tmad_price,
			tmad_batch_code:item.tmad_batch_code,
			tmad_qgp:item.tmad_qgp,
			tmad_status:item.tmad_status,
			back_tmascd_num:item.back_tmascd_num,
			tmaid_num:item.tmaid_num,
			tmaod_num:item.tmaod_num,
			tmascd_num:item.tmascd_num,
			tmascd_num_yk:item.tmascd_num_yk,
			tmascd_num_s:item.tmascd_num_s,
			tmascd_num_c:item.tmascd_num_c,
			num:parseInt(item.tmascd_num) + parseInt(item.tmascd_num_yk) - parseInt(item.tmascd_num_s) - parseInt(item.tmascd_num_c),
			money:(parseInt(item.tmascd_num) + parseInt(item.tmascd_num_yk) - parseInt(item.tmascd_num_s) - parseInt(item.tmascd_num_c)) * parseFloat(item.tmad_price)
        });
        no = no + (parseInt(item.tmascd_num) + parseInt(item.tmascd_num_yk) - parseInt(item.tmascd_num_s) - parseInt(item.tmascd_num_c)) * parseFloat(item.tmad_price);
    });
    TmaStoreCheck.set({ data: jsonObj });
    $("#a1").html(formatCurrency(no));
}
/*
 * 新建盘点信息
 */
function insert(s){
	var tmascm_code = $("#tmascm_code").val().trim();
	var tmascm_name = $("#tmascm_name").val().trim();
	if('' == tmascm_code){warningTip("盘点编号：不能为空"); return;}
	if(!checkIsStrNum(tmascm_code)){
		warningTip("盘点编号：必须为字母、数字组成");
		return;
	}
	if(fucCheckLength(tmascm_code) > 32){
		warningTip("盘点编号：不能超过32字符");
		return;
	}
	if('' == tmascm_name){warningTip("盘点名称：不能为空"); return;}
	if(!checkIsString(tmascm_name)){
		warningTip("盘点名称：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tmascm_name) > 64){
		warningTip("盘点名称：不能超过64字符");
		return;
	}
	if(s == 0){
		$("#tmascm_is_valid").val("0");
	}else{
		$("#tmascm_is_valid").val("1");
	}
	jisuan();
		//定义入库明细编号参数
		var param = {
			"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckMainAction",
			"methodname": "",
			"logicdata": [],
			"extenddata": []
		};
		var tmascm_id = $("#tmascm_id").val();
		if(tmascm_id==""){
			param.methodname = "save";
		}else{
			param.methodname = "update";
		}	
		var data = getForm("TmaStoreCheckMain-form");
		$.each(TmaStoreCheck.getData(), function (i, item) {
			mingxi.push({
	    		tmad_id:item.tmad_id,
	    		tmascd_id:item.tmascd_id,
	    		back_tmascd_num:item.back_tmascd_num,
				tmaid_num:item.tmaid_num,
				tmaod_num:item.tmaod_num,
	    		tmascd_num_yk:item.tmascd_num_yk,
				tmascd_num_s:item.tmascd_num_s,
				tmascd_num_c:item.tmascd_num_c,
	    		num:item.num
	    	});
        });
		var d = data.substring(0,data.length-2);
		d = d+",ids:"+JSON.stringify(mingxi)+"}]";
		param.logicdata = d;
		callserver(param, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
}
/*
 * ajax成功回调
 */
function ajaxCallbackSuccFunc(data, textStatus){
	if(data.result){
		$("#TmaStoreCheckMainAdd-div").hide();
	}
	succMsgTip(data.resultrecord);
	reload();
	win = true;
}

/*
 * ajax失败回调
 */
function ajaxCallbackErrorFunc(data, textStatus){
	warningTip(data.resultrecord);
}
//药品名
var TmaStoreCheckMainleixing_d;
function yaopinming(record){
	if(TmaStoreCheckMainleixing_d==null){
	}else{
		TmaStoreCheckMainleixing_d.hide();
	}	
	TmaStoreCheckMainleixing_d = initWindowByDiv2('TmaStoreCheckMainleixingdiv-div', '药品查看', 565, 395, closeWin);
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckDetailAction",
		"methodname": "selectTmaDictionaryByTmadName",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmad_name\":\""+record.tmad_name+"\",\"org_id\":\""+org_id+"\"}]";
	TmaStoreCheckMainleixing.setOptions({url:_url,parms: param});
}
//取消
function quxiao(){
	if(TmaStoreCheckMainleixing_d==null){
	}else{
		TmaStoreCheckMainleixing_d.hide();
	}
	$("#TmaStoreCheckMainAdd-div").hide();
	win = true;
}
/*
 * 导出
 */
function expData(record){
	var param = {
		"classname": "com.wxtf.platform.main.contraceptives.TmaStoreCheckDetailAction",
		"methodname": "expData",
		"logicdata": [],
		"extenddata": []
	};
	param.logicdata = "[{\"tmascm_id\":\""+record.tmascm_id+"\"}]";
	
	callserver(param, function(data, textStatus){
		if(data.result){
			downloadFile(data.resultrecord);
		} else {
			warningTip(data.resultrecord);
		}
	}, function(data, textStatus){
	});
}
function formatCurrency(num)
{
    if (!num) return "0.00";
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
        num = "0.00";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    cents = num % 100;
    num = Math.floor(num / 100).toString();
    if (cents < 10)
        cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
        num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
    return (((sign) ? '' : '-') + '' + num + '.' + cents);
}
</script>
</head>
	<body>
		<div id="TmaStoreCheckMain-grid"></div>
		<div id="TmaStoreCheckMainleixingdiv-div" style="display: none;">
			<div id="TmaStoreCheckMainleixing-grid"></div>
		</div>
		<div id="TmaStoreCheckDetail-div" style="display: none;">				
				<table class="form_table">
					<tr>
						<td class="form_label">盘点编号：</td>
						<td><input disabled="disabled" class="textbg1" id="d_tmascm_code" name="d_tmascm_code"/></td>
						<td class="form_label">盘点名称：</td>
						<td><input disabled="disabled" class="textbg1" id="d_tmascm_name" name="d_tmascm_name"/></td>
					</tr>
					<tr>
						<td class="form_label">组织机构：</td>
						<td><input disabled="disabled" class="textbg1" id="d_org_id" name="d_org_id"/></td>
						<td class="form_label">录入人：</td>
						<td><input disabled="disabled" class="textbg1" id="d_create_by" name="d_create_by"/></td>
					</tr>
					<tr>
						<td class="form_label">总金额：</td>
						<td><input disabled="disabled" class="textbg1" id="d_money" name="d_money"/></td>
						<td colspan="2"></td>
					</tr>
					<tr>
						<td colspan="4"><div id="detail1"></div></td>
					</tr>				
				</table>
		</div>
		<div id="TmaStoreCheckMainAdd-div" style="background-color: white; display: none; position: absolute; top: 20px; left: 50px;background: url('resource/images/pbg.jpg') repeat;">
		<div align="left" style="background: url('ligerUI/skins/Aqua/images/win/dialog-tc.gif') repeat-x; font-size: 15px; color: white;">药具盘点</div>
		<div style="background-color: white; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;">
		<div>
			<form id="TmaStoreCheckMain-form" name="TmaStoreCheckMain-form">
			<input type="hidden" id="tmascm_id" name="tmascm_id"/>
			<input type="hidden" id="tmascm_memo" name="tmascm_memo"/>
			<input type="hidden" id="tmascm_type" name="tmascm_type" value="月盘点"/>		
				<table class="form_table">
					<tr>
						<td class="form_label">盘点编号：</td>
						<td><input class="textbg1" id="tmascm_code" name="tmascm_code" /></td>
						<td class="form_label">盘点名称：</td>
						<td><input class="textbg1" id="tmascm_name" name="tmascm_name" /></td>
					</tr>
					<tr>						
						<td class="form_label">组织机构：</td>
						<td>
							<input disabled="disabled" class="textbg1" id="org_id" name="org_id" value=""/>
						</td>
						<td class="form_label">录入人：</td>
						<td><input readonly="readonly" id="create_by" name="create_by" class="textbg1" /></td>
					</tr>
					<tr>
						<td class="form_label" style="display: none;">是否提交：</td>
						<td style="display: none;">
							<select id="tmascm_is_valid" name="tmascm_is_valid" style=" width: 182px;">
								<option value="1">是</option>
								<option value="0" selected="selected">否</option>
							</select>
						</td>
						<td></td>
						<td></td>
						<td class="form_label">总金额：</td>
						<td id="a1"></td>
					</tr>
					<tr>
						<td colspan="4"><div id="TmaStoreCheckDetail-grid"></div></td>
					</tr>			
				</table>
			</form>
		</div>
		<div align="right" style="background-color:#F5F8F9; margin-top: 5px;"><input style=" width: 80px; margin: 3px;" type="button" value="暂存" onclick="insert(0);"/><input style=" width: 80px; margin: 3px;" type="button" value="提交" onclick="insert(1);"/><input style=" width: 80px; margin: 3px;" type="button" value="取消" onclick="quxiao();"/></div>
		</div>
		</div>
	</body>
</html>